import java.util.Scanner;

public class Day44 {
    // 单词倒排（先倒排子序列，再倒排整个序列）
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String src = in.nextLine();
            int i = 0;
            int start = 0;
            int end = 0;
            StringBuilder res = new StringBuilder();
            while (i < src.length()) {
                if (!isWord(src.charAt(i))) {
                    end = i;
                    String substring = src.substring(start, end);
                    res.append(reverse(substring)+" ");
                    // 吃掉多余的分隔符
                    while (i < src.length() && !isWord(src.charAt(i))) {
                        i ++;
                        start = i;
                    }
                }
                i ++;
            }
            res.append(reverse(src.substring(start,src.length())));
            System.out.println(reverse(res.toString()));
        }

    }
    // 判断是否为字符
    private static boolean isWord(char ch) {
        return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
    }
    // 倒排函数
    private static String reverse(String str) {
        char[] arr = str.toCharArray();
        int start = 0;
        int end = arr.length-1;
        while (start < end) {
            char tmp = arr[start];
            arr[start] = arr[end];
            arr[end] = tmp;
            start ++;
            end --;
        }
        return new String(arr);
    }
}
